package com.chixing.day12_date_factory;

import com.chixing.day10_hashcode_exception.Account;

import java.util.Collection;

public class GenerlcDemo {
    int age;
    public static void fun1(Pointer<Integer> pointer){

    }
    public static void fun2(Pointer<String> pointer){

    }
    //？通配符：  可以匹配任意的 泛型类型

    public static void fun3(Pointer<?> pointer){

    }


    //? extends Account : 通配符 上限
    public static void fun4(Pointer<? extends Account> pointer){//形参

    }

    //<F> 作用域 仅在该方法
    public<F> void fun5(F a){
        int aaa;
        return;
    }

    public static void main(String[] args) {

        Collection<Account> collection ;




        Pointer<Account> pointer1 = new Pointer<>();
        Pointer<SavingAccount> pointer2 = new Pointer<>();
        Pointer<CraditAccount> pointer3 = new Pointer<>();
        fun4(pointer1);
        fun4(pointer2);
        fun4(pointer3);

        Pointer<Integer> p1 = new Pointer<>();
        fun1(p1);

        Pointer<String> p2 = new Pointer<>();
        fun2(p2);

        fun3(p1);
        fun3(p2);
        Pointer<Float> p3 = new Pointer<>();
        fun3(p3);

        Pointer<Account> p4 = new Pointer<>();
        fun3(p4);


        A<Account> a = new A<>();
        A<SavingAccount> a1 = new A<>();
        A<CraditAccount> a2 = new A<>();
    }
}

class SavingAccount extends Account{}
class CraditAccount extends Account{}

class A<T extends Account> {

}
